home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 August / MW 8 2003 CD1.iso / Inside Macworld / Product News / gimp-1.2.4.sit / gimp-1.2.4 / plug-ins / script-fu / scripts / basic2-logo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2003-02-27  |  3.8 KB  |  100 lines

  1. ;  HIGHLIGHT-DROP-SHADOW-LOGO
  2. ;  draw the specified text over a background with a drop shadow and a highlight
  3.  
  4. (define (color-highlight color)
  5.   (let ((r (car color))
  6.     (g (cadr color))
  7.     (b (caddr color)))
  8.     (set! r (+ r (* (- 255 r) 0.75)))
  9.     (set! g (+ g (* (- 255 g) 0.75)))
  10.     (set! b (+ b (* (- 255 b) 0.75)))
  11.     (list r g b)))
  12.  
  13. (define (apply-basic2-logo-effect img
  14.                   logo-layer
  15.                   bg-color
  16.                   text-color)
  17.   (let* ((width (car (gimp-drawable-width logo-layer)))
  18.      (height (car (gimp-drawable-height logo-layer)))
  19.      (posx (- (car (gimp-drawable-offsets logo-layer))))
  20.      (posy (- (cadr (gimp-drawable-offsets logo-layer))))
  21.      (bg-layer (car (gimp-layer-new img width height RGB_IMAGE "Background" 100 NORMAL)))
  22.      (highlight-layer (car (gimp-layer-copy logo-layer TRUE)))
  23.      (shadow-layer (car (gimp-layer-new img width height RGBA_IMAGE "Shadow" 100 MULTIPLY)))
  24.      (old-fg (car (gimp-palette-get-foreground)))
  25.      (old-bg (car (gimp-palette-get-background))))
  26.     (gimp-selection-none img)
  27.     (script-fu-util-image-resize-from-layer img logo-layer)
  28.     (gimp-image-add-layer img bg-layer 1)
  29.     (gimp-image-add-layer img shadow-layer 1)
  30.     (gimp-image-add-layer img highlight-layer 1)
  31.     (gimp-palette-set-foreground text-color)
  32.     (gimp-layer-set-preserve-trans logo-layer TRUE)
  33.     (gimp-edit-fill logo-layer FG-IMAGE-FILL)
  34.     (gimp-edit-clear shadow-layer)
  35.     (gimp-palette-set-foreground (color-highlight text-color))
  36.     (gimp-layer-set-preserve-trans highlight-layer TRUE)
  37.     (gimp-edit-fill highlight-layer FG-IMAGE-FILL)
  38.     (gimp-palette-set-background bg-color)
  39.     (gimp-drawable-fill bg-layer BG-IMAGE-FILL)
  40.     (gimp-selection-layer-alpha logo-layer)
  41.     (gimp-palette-set-background '(0 0 0))
  42.     (gimp-selection-feather img 7.5)
  43.     (gimp-edit-fill shadow-layer BG-IMAGE-FILL)
  44.     (gimp-selection-none img)
  45.     (gimp-palette-set-foreground '(255 255 255))
  46.     (gimp-blend logo-layer FG-BG-RGB MULTIPLY RADIAL 100 20 REPEAT-NONE FALSE 0 0 0 0 width height)
  47.     (gimp-layer-translate shadow-layer 3 3)
  48.     (gimp-layer-translate highlight-layer (- posx 2) (- posy 2))
  49.     (gimp-layer-set-name highlight-layer "Highlight")
  50.     (gimp-palette-set-background old-bg)
  51.     (gimp-palette-set-foreground old-fg)))
  52.  
  53. (define (script-fu-basic2-logo-alpha img
  54.                      logo-layer
  55.                      bg-color
  56.                      text-color)
  57.   (begin
  58.     (gimp-undo-push-group-start img)
  59.     (apply-basic2-logo-effect img logo-layer bg-color text-color)
  60.     (gimp-undo-push-group-end img)
  61.     (gimp-displays-flush)))
  62.  
  63. (script-fu-register "script-fu-basic2-logo-alpha"
  64.             _"<Image>/Script-Fu/Alpha to Logo/Basic II..."
  65.             "Creates a simple logo with a shadow and a highlight"
  66.             "Spencer Kimball"
  67.             "Spencer Kimball"
  68.             "1996"
  69.             "RGBA"
  70.                     SF-IMAGE      "Image" 0
  71.                     SF-DRAWABLE   "Drawable" 0
  72.                    SF-COLOR      _"Background Color" '(255 255 255)
  73.             SF-COLOR      _"Text Color" '(206 6 50))
  74.  
  75. (define (script-fu-basic2-logo text
  76.                    size
  77.                    font
  78.                    bg-color
  79.                    text-color)
  80.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  81.      (text-layer (car (gimp-text-fontname img -1 0 0 text 10 TRUE size PIXELS font))))
  82.     (gimp-image-undo-disable img)
  83.     (gimp-layer-set-name text-layer text)
  84.     (apply-basic2-logo-effect img text-layer bg-color text-color)
  85.     (gimp-image-undo-enable img)
  86.     (gimp-display-new img)))
  87.  
  88. (script-fu-register "script-fu-basic2-logo"
  89.             _"<Toolbox>/Xtns/Script-Fu/Logos/Basic II..."
  90.             "Creates a simple logo with a shadow and a highlight"
  91.             "Spencer Kimball"
  92.             "Spencer Kimball"
  93.             "1996"
  94.             ""
  95.             SF-STRING     _"Text" "SCRIPT-FU"
  96.             SF-ADJUSTMENT _"Font Size (pixels)" '(150 2 1000 1 10 0 1)
  97.             SF-FONT       _"Font" "-*-futura_poster-*-r-*-*-24-*-*-*-p-*-*-*"
  98.             SF-COLOR      _"Background Color" '(255 255 255)
  99.             SF-COLOR      _"Text Color" '(206 6 50))
  100.